# from django.shortcuts import render
from django.http import HttpResponse


# ImageTemplate='file_viewer/image.html'
# ImageSuffix=['jpg','png','jpeg','gif','web']

from pathlib import Path
import os
BaseDir=Path(__file__).parent.parent/'files'
def view(request,file_path):
    absolute_path=BaseDir/file_path
    if os.path.exists(absolute_path)==False:
        return HttpResponse('文件不存在')
    cmd=f'start {BaseDir/file_path}'
    print(cmd)
    os.system(cmd)
    return HttpResponse('文件已打开')
    
